using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class LootItem : MonoBehaviour
{
    [System.Serializable]
    public class LooteItems
    {
        public GameObject item;
        [Range(0,1)]
        public float weight;
    }

    public LooteItems[] LooteItemsArray;

    public void Spawnloot()
    {
        float tempValue = Random.Range(0, 1);

        for (int i = 0; i < LooteItemsArray.Length; i++)
        {
            if (tempValue < LooteItemsArray[i].weight)
            {
                GameObject obj = Instantiate(LooteItemsArray[i].item);
                obj.transform.position = transform.position + Vector3.up * 2;
            }
        }
    }
}
